﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using myFirtz.Interface;
using System.Xml.Serialization;
using System.IO;
using System.Xml;

namespace myFritz.ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            //Test();
            //Test3();
            Test2();
            Console.Read();
        }

        private static void Test()
        {
            Session session = new Session("********", "********", "fritz.box");

            Console.WriteLine("Connecting...");

            if (session.Connect())
                Console.WriteLine(session.Sid);
            else
                Console.WriteLine(Helper.LastException.Message);

            Console.WriteLine("setswitchtoggle");
            Helper.GetSwitchList(session);            
        }

        private static void Test2()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(DeviceList));            
            FileStream fs = new FileStream(@"C:\Temp\xxx.xml", FileMode.Open);
            DeviceList i = (DeviceList)serializer.Deserialize(fs);
            fs.Close();
        }

        private static void Test3()
        {
            DeviceList i = new DeviceList();

            i.devicelist.Add(new Device() { Name = "Name", Switch = new Switch() { Mode = "1", Lock = "2", State = "3" }, Identifier = "sdfsdfdsf" });
            XmlSerializer x = new XmlSerializer(i.GetType());
            x.Serialize(Console.Out, i);
        }
    }
}
